package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.domain.PageResult;
import com.itheima.domain.pojo.OperateLog;
import com.itheima.mapper.LogMapper;
import com.itheima.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;
    @Override
    public PageResult<OperateLog> page(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<OperateLog> loglist = logMapper.lists( );
        Page<OperateLog> p=(Page<OperateLog>) loglist;

        return new PageResult<OperateLog>(p.getTotal(),p.getResult());
    }
}
